<template>
	<view class="crossCourse">
		<view class="BGIMG" :style="{'background-image':`url(${URL}${objectData.Cover})`}"></view>
		<view class="content">
			<view class="Title">
				{{objectData.Title}}
			</view>
			<view class="titlebottom">
				<view class="Price">
					<span class="fuhao">￥</span>
					<span class="zhengshu">{{Price(objectData.Price)}}</span>
					<span class="dian">.</span>
					<span class="xiaoshu">{{Price1(objectData.Price)}}</span>
				</view>
				<view class="StudyCount">{{objectData.StudyCount}}人已学习</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		props: {
			objectData: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {
				URL: this.$config.domain.staticUrl,
			}
		},
		methods: {
			// 价格格式调整
			Price(e) {
				let num = Math.floor(e)
				if (num >= 0) {
					return num
				} else {
					return e
				}
			},
			Price1(e) {
				let afterNum = (e % 1).toFixed(2).substring(2)
				if (afterNum >= 0) {
					return afterNum
				}
			},
		}
	}
</script>

<style lang="scss">
	.crossCourse {
		box-sizing: border-box;
		padding: 20rpx;
		background-color: #fff;
		display: flex;
		justify-content: flex-start;
		border-radius: 20rpx 20rpx 20rpx 20rpx;

		.BGIMG {
			// border-top-left-radius: 12rpx;
			// border-top-right-radius: 12rpx;
			border-radius: 6rpx;
			background-color: red;
			// background-position: center;
			background-repeat: no-repeat;
			background-size: 100%;
			width: 270rpx;
			height: 164rpx;
			overflow: hidden;
			margin-right: 16rpx;
		}

		.content {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			box-sizing: border-box;
			padding: 3rpx 0rpx;

			.Title {
				color: #000000;
				font-size: 32rpx;
				white-space: normal;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				min-height: 70rpx;
				font-family: PingFang SC-Bold;
			}

			.titlebottom {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.Price {
					font-family: PingFang SC-Bold;
					color: #F35370;

					.fuhao {
						font-size: 26rpx;
						font-weight: bold;
					}

					.zhengshu {
						font-size: 38rpx;
						font-weight: bold;
					}

					.dian {
						font-size: 42rpx;
					}

					.xiaoshu {
						font-size: 26rpx;
					}
				}

				.StudyCount {
					background: rgba(52, 118, 254, 0.1);
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					padding: 7rpx 16rpx;
					font-size: 24rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: 400;
					color: #3476FE;

				}
			}


		}
	}
</style>